Ext.require('AM.service.Insert');


Ext.define('AM.component.menu.InsertMenu', {


    singleton:true,


    getInstance:function () {
        var item1 = {xtype:'button', text:'文字', handler:AM.service.Insert.insertText};
        var item2 = {xtype:'filefield', buttonText:'图片', buttonOnly:true, listeners:{ 'change':AM.service.Insert.insertImg }        }
        var item21 = {xtype:'button', text:'图片(远程)', handler:function () {
            if (this.win == null)
                this.win = Ext.create('AM.picker.Image')
            else this.win.show();

        } }

        var item3 = {xtype:'filefield', buttonText:'声音', buttonOnly:true, listeners:{ 'change':AM.service.Insert.insertAudio  } }
        var item31 = {xtype:'button', text:'声音(远程)', handler:function () {
            if (this.win == null)
                this.win = Ext.create('AM.picker.Audio')
            else this.win.show();
        } }
        var item4 = {xtype:'filefield', buttonText:'视频', buttonOnly:true, listeners:{'change':AM.service.Insert.insertVideo}};
        var item5 = {xtype:'button', text:'表格', handler:AM.service.Insert.insertTable};
        var item6 = {xtype:'button', text:'链接到其他页', handler:AM.service.Insert.insertPageLink};
        var item7 = {xtype:'button', text:'形状',
            handler:function () {
                var me = this;
                if (Ext.isEmpty(me.win)) {
                    me.win = Ext.create('AM.picker.Shape')
                }
                else {
                    me.win.show();
                }
            }
        }
        var item8 = {
            xtype: 'button',
            text: '符号',
            handler: function() {
                Ext.create('AM.component.Symbol')
            }
        }


        return {
            xtype:'panel',
            title:'插入',
            items:[
                {
                    xtype:'toolbar',
                    items:[item1, '-', item2, item21, '-', item3, item31, '-', item4, item5, item6, item7, '-', item8]
                }
            ]
        };

    }


})

